package WaiBao;

import java.util.Arrays;

public class WuShuZhen {
    public static void main(String[] args) {
        String[] name = {"徐浩(班长)", "刘曦(团支书)", "小李(学习委员)", "黄敏(纪律委员)", "古根", "天启", "中燃", "汉鼎", "张晶晶", "王晶晶", "李怡然", "吕莎",
                "郑宇", "冯浩", "刘军", "王文", "张大大", "王晓晓", "纪伯伦", "张村发", "李大宝", "张晓红", "黄芪", "罗奇缘", "尝试元", "陈词", "申诉", "刘西金",
                "杨玉环", "武淑贞(学生)"};//最后一位考生本人: 武淑贞(学生)
        int[] Age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 19};//考生年龄：19岁


        //最后三个成绩代表考生自拟成绩
        double[] shuju1 = {94, 84, 93, 80, 71, 67, 74, 89, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[] shuju2 = {88, 93, 79, 76, 89, 97, 81, 76, 91, 75, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 94};
        double[] shuju3 = {77, 98, 90, 81, 71, 64, 75, 79, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 95};

        double wal;//代表每个学生的总分
        double dolphin;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            wal = (shuju1)[i] + shuju2[i] +shuju3[i];
//            dolphin = (  wal * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" +  wal);
//            System.out.println(name[i] + "的平均分为:" + dolphin);
//        }



        double seal = 0, otter = 0;
        double[] crab = new double[30];
//        for (int i = 0; i < 30; i++) {
//            seal   = shuju1[i] +  shuju2[i] + shuju3[i];
//            otter = (seal  * 1.0) / 3;
//            crab[i] = otter;
//        }
//
//        for (int i = 0; i < crab.length - 1; i++) {
//            for (int j = 0; j < crab.length - i - 1; j++) {
//                if (crab[j] < crab[j + 1]) {
//                    double tep = crab[j];
//                    crab[j] =crab[j + 1];
//                    crab[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(crab[i]);
//        }



        double shri1 = 0, shri2 = 0, shri3 = 0;//计算每门课的平均分
        double gavi1 = 0,gavi2 = 0,gavi3 = 0;//计算每门课标准差
        double bull1 = 0, bull2 = 0, bull3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < shuju1.length; i++) {
            sum2+=shuju1[i];
        }
        shri1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+ shri1);
        double Sum = 0;
        for (int i = 0; i < shuju2.length; i++) {
            Sum+=shuju2[i];
        }
        shri2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+ shri2);
        double sum = 0;
        for (int i = 0; i <shuju3.length; i++) {
            sum+=shuju3[i];
        }
        shri3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+ shri3);


//
        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <shuju1.length; i++) {
            c1+= (shuju1[i] -shri1)*(shuju1[i] - shri1);
        }
        gavi1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+gavi1);

        for (int i = 0; i < shuju2.length; i++) {
            c2+= (shuju2[i] -  shri2)*(shuju2[i] - shri2);
        }
        gavi2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+gavi2);

        for (int i = 0; i < shuju3.length; i++) {
            c3+= (shuju3[i] - shri3)*(shuju3[i] -  shri3);
        }
        gavi3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+gavi3);
//////
////////
        Arrays.sort(shuju1);
//        Arrays.sort(shuju2);
//        Arrays.sort(shuju3);
//        bull1 =( shuju1[14]+shuju1[15])*1.0/2;
//        bull2 =( shuju2[14]+shuju2[15])*1.0/2;
//        bull3 =( shuju3[14]+shuju3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+bull1);
//        System.out.println("微生物学的中位数为:"+bull2);
//        System.out.println("人体组织解剖学的中位数为:"+bull3);
////



    }
}
